home *** CD-ROM | disk | FTP | other *** search
/ Singles Flirt Up Your Life! (German) / Singles Flirt Up Your Life.iso / data1.cab / Statemachine / camera.lua < prev    next >
Text File  |  2004-01-29  |  1KB  |  42 lines

  1. -- camera state machine
  2.  
  3. beginStateMachine()
  4.  
  5.     onMsg("buildMenu", function(msg)
  6.     
  7.         if (repairMenu()) then return end
  8.         
  9.         -- build the pie menu
  10.         clearPieMenu();
  11.         local button;
  12.         button = addPieMenuButton("Fotos Machen", "takePicture");
  13.         button.addDescription(ACTIVITY, "takePicture");
  14.         -- button.addIcon("guiIconHygiene");
  15.     end )
  16.  
  17.     -- 
  18.     onMsg("takePicture", function(msg)
  19.         -- get the game object server
  20.         local gameObjectServer = getGameObjectServer();
  21.         -- get character who initiated this action
  22.         local character = getStateObjectFromID(msg.sender);
  23.         -- walk to the closest action point
  24.         local actionPoint = character.getFreeActionPoint(this, "use");
  25.         if (actionPoint) then
  26.             -- get the walk state object
  27.             local wso = character.walkSO;
  28.             if (wso.walkToActionPoint(actionPoint)) then
  29.                 wso.queueStateMachine("cameraChar.waitForPartner", this);
  30.             else
  31.                 print("no path found");
  32.                 instantAbort(character, EMOTICON_NOPATH, "emoThink")
  33.             end
  34.         else
  35.             print("no action point found");
  36.             instantAbort(character, EMOTICON_CANNOT, "emoThink")
  37.         end
  38.     end )
  39.             
  40.             
  41. endStateMachine()
  42.